import React, { lazy } from 'react';
import { useSelector } from 'react-redux';
interface Props {
    perm: string
    children: any
}
const NotFound = lazy(() => import('../views/NotFound'))
function Qxyz(props: Props) {
    var checkedKeys = useSelector((state: any) => state.userInfo.checkedkeys)
    var res =checkedKeys.length==0 || checkedKeys.includes(props.perm)
    
    return (
        <div>
            {res ? props.children : <NotFound />}
        </div>
    );
}

export default Qxyz;